package com.shmn.gongjiajumain.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.shmn.gongjiajumain.vo.purchaseincome.PurchaseincomesubmithistoryFromVo;
import com.shmn.gongjiajumain.vo.repair.RepairSubmitHistoryFormVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.shmn.gongjiajumain.entity.RepairSubmitEntity;
import com.shmn.gongjiajumain.service.RepairSubmitService;
import com.shmn.common.utils.PageUtils;
import com.shmn.common.utils.R;



/**
 * 记录报修申请
 *
 * @author chenshun
 * @email 1005074582@qq.com
 * @date 2023-05-14 16:40:27
 */
@RestController
@RequestMapping("gongjiajumain/repairsubmit")
public class RepairSubmitController {
    @Autowired
    private RepairSubmitService repairSubmitService;

    @PostMapping("/list1")
    //@RequiresPermissions("gongjiajumain:purchaseincomesubmit:list")
    public R list2(@RequestBody RepairSubmitHistoryFormVo repairSubmitHistoryFormVo){
        System.out.println(repairSubmitHistoryFormVo);
        PageUtils page = repairSubmitService.queryPage1(repairSubmitHistoryFormVo);

        return R.ok().put("page", page);
    }

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("gongjiajumain:repairsubmit:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = repairSubmitService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("gongjiajumain:repairsubmit:info")
    public R info(@PathVariable("id") Integer id){
		RepairSubmitEntity repairSubmit = repairSubmitService.getById(id);

        return R.ok().put("repairSubmit", repairSubmit);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("gongjiajumain:repairsubmit:save")
    public R save(@RequestBody RepairSubmitEntity repairSubmit){
		repairSubmitService.save(repairSubmit);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("gongjiajumain:repairsubmit:update")
    public R update(@RequestBody RepairSubmitEntity repairSubmit){
		repairSubmitService.updateById(repairSubmit);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("gongjiajumain:repairsubmit:delete")
    public R delete(@RequestBody Integer[] ids){
		repairSubmitService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
